import React from "react"
// 1.类组件
class Hello extends React.Component {

  constructor() {
    super()
    this.state = {
      count: 0
    }
    this.clickHandler = this.clickHandler.bind(this)
  }

  // state = { count: 7 }

  clickHandler() {
    console.log(2)
    this.setState({count: this.state.count + 1})
  }
  render() {
    return (
      <div>
        <div>{ this.state.count }</div>
        <button onClick={this.clickHandler}>点我打印2</button>
      </div>
    )
  }
}

export default Hello